package demo14

// 状态设计模式
import "fmt"
type Week interface{
	Today()
	Next(*DayContext)
}



type DayContext struct{
	today  Week
}

func NewDayContext() *DayContext{
	return &DayContext{
		today:&Sunday{},
	}
}

func (c *DayContext)Today(){
	c.today.Today()
}

func (c *DayContext)Next(){
	c.today.Next(c)
}

type Sunday struct{}

func (*Sunday)Today(){
	fmt.Println("sunday")
}
func (*Sunday)Next(d *DayContext){
	d.today = &Monday{}
}

type Monday struct{}

func (*Monday)Today(){
	fmt.Println("monday")
}

func (*Monday)Next(d *DayContext){

}